<template>
  <view class="wrap">
    <head-box></head-box>
    <view class="wrap-body">
      <view class="wrap-header">
        <view class="wrap-header-item">请输入活动编码</view>
      </view>
      <view>
        <view class="input-wrap">
          <u-message-input :focus="true" :maxlength="input_len" @finish="onFinish"></u-message-input>
        </view>

      </view>
      <view class="message">
        <view class="message_title"><image class="message_logo" src="../../static/img/message.png" mode="aspectFit"></image> 温馨提示</view>
        <view class="message_ts">1.活动编码为{{input_len}}位数字,由活动发布者告知</view>
        <view class="message_ts">2.活动编码请勿在公共场所,网络聊天室等渠道公开传播</view>
      </view>
    </view>
    <tabs-box></tabs-box>
  </view>
</template>
<script>
import { checkGpMovedate,gpMoveInfo} from '@/common/request.js';
export default {
  data() {
    return {
      moveId:'',
      MoveInfo:{},
      input_len: 6, // 验证码长度
      input_val: '', // 验证码的值
      isFocus: false
    };
  },
  onLoad(options) {
    if(!!options.id)
    {
      this.moveId = options.id;
    }
    this.GetData();
  },
  onShow(){
    // #ifdef H5
    console.log('分享')
    this.$wxSetShare()
    // #endif
  },
  methods: {
    GetData(){
      var that = this
      let params = {"moveId": that.moveId}
      gpMoveInfo(params).then(res => {
        if(res.success)
        {
          that.MoveInfo = res.result;
        }
      })
    },
    onFinish(e){
      this.input_val = e
      const params ={"movedateCode":this.input_val,"moveId":this.moveId}
      checkGpMovedate(params).then(res => {
        if(res.success)
        {
          this.$api.msg("签到成功");
          setTimeout(() => {
            uni.navigateBack();
          }, 1000);
        }
        else
        {
          this.$api.msg(res.message);
        }
      });
    },
  }
};
</script>
<style lang="scss">
.wrap {
}
.wrap-body{
  padding: 60rpx;
  .message{
    background-color: #dee8ff;
    margin-top: 60rpx;
    padding: 40rpx;
    border-radius: 20rpx;
    color: #4f74c7;
    .message_title{
      padding: 0 0 20rpx 0;
      .message_logo{
        width: 40rpx;
        height: 40rpx;
        display: inline-block;
        vertical-align: middle;
        margin-right: 20rpx;
      }
    }
    .message_ts{
      font-size: 26rpx;
      padding: 8rpx;
    }

  }
}
.wrap-header {
  padding: 90rpx 0;

  .wrap-header-item {
    font-size: 42rpx;
    margin-bottom: 17rpx;
    text-align: center;
  }
}

.input-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;

  .input1 {
    width: 80rpx;
    height: 80rpx;
    border-bottom: 1px solid #cccccc;
    justify-content: center;
    text-align: center;
    font-size: 50rpx;

  }
  .fun{
    box-shadow: 0 0 15px #dee8ff;
    border-radius: 10rpx;
  }
  .rinput
  {
    border: 0rpx;
  }
}

.input2 {
  height: 50rpx;
  width: 100%;
  position:absolute;
  top: -200rpx;
}
</style>
